package mgslangpack;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class ViewStaff
{
    public ViewStaff() throws Exception
    {
        Button b1,b2;
        final JFrame jf = new JFrame("Staff Members");
        jf.setSize(750,600);
        jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        jf.setLayout(null);
        jf.setVisible(false);
        Container ctn=jf.getContentPane();
        ctn.setBackground(Color.LIGHT_GRAY);
        Font f1 = new Font("Times New roman",Font.BOLD,24);
        Label l3 = new Label("Staff Members List");
        l3.setBounds(150,10,250,40);
        l3.setFont(f1);
        jf.add(l3);
        final TextArea ta = new TextArea();
        ta.setBounds(100,50,500,400);
        ta.setEditable(false);
        ta.setBackground(Color.WHITE);
        jf.add(ta);        
        String idn,nm,sn,hp,cp,em,box,sb,tw,pc,dis;
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        final Connection con = DriverManager.getConnection("jdbc:odbc:TheOZ_DB","","");
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery("Select * From Staff");
        while(rs.next())
        {
            idn = rs.getString(1);
            nm = rs.getString(2);
            sn = rs.getString(3);
            hp = rs.getString(4);
            cp = rs.getString(5);
            em = rs.getString(6);
            box = rs.getString(7);
            sb = rs.getString(8);
            tw=rs.getString(9);
            pc=rs.getString(10);
            dis=rs.getString(11);
            ta.append("\nDiscription:\t"+dis+"\nID Number:\t"+idn+"\nName:\t\t"+nm+"\nSurname:\t"+sn+"\nHome Phone No:\t"+hp+"\nCell Number:\t"+cp+"\nEmail Address:\t"+em+"\nAddress:\t"+box+"\n\t\t"+sb+"\n\t\t"+tw+"\n\t\t"+pc+"\n\n");
            ta.append(" ");
        }
        b1 = new Button("Back");
        b1.setBounds(150,500,80,30);
        b1.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                try
                {
                    jf.hide();
                    MenuAdmin ma = new MenuAdmin();
                }
                catch(Exception e1){}
            }
        }
        );
        jf.add(b1);
        b2 = new Button("Quit");
        b2.setBounds(520,500,80,30);
        b2.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                try
                {
                    System.exit(0);
                }
                catch(Exception e1){}
            }
        }
        );
        jf.add(b2);
        jf.show();
    }
}
/******************************************************************************/